java.lang.Object
ddejonge.bandana.tools.Logger
public class Logger
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<java.lang.String>
content
-
Constructor Summary
Constructors Constructor Description Logger()
-
Method Summary
Modifier and Type Method Description void
enable(java.lang.String folderPath)
Creates the log file at the given path with a default file name.void
enable(java.lang.String folderPath, java.lang.String fileName)
Creates the log folder at the specified path, and creates a log file with the specified name.void
enable(java.lang.String folderPath, java.lang.String fileName, boolean useTimeStamp)
Creates the log folder at the given path, and creates the log file with a file name that starts with a time stamp and then the given file name.static java.lang.String
getDateString()
Returns a string that represents the current date and time.java.lang.String
getLogFileName()
Returns the name of the log file.java.lang.String
getLogFolderPath()
Returns the path to the folder where the log file will be stored.void
log(int n)
void
log(int n, boolean print)
void
log(java.lang.String s)
Appends text to the last line in the log.
Note however that this is not yet written to file, until you call writeToFile()void
log(java.lang.String s, boolean print)
Appends text to the last line in the log.
Note however that this is not yet written to file, until you call writeToFile()void
log(java.lang.Throwable e)
void
logln()
Adds a blank line to the log.void
logln(java.lang.Object s)
Adds a new line to the log containing the string representation of the given object.void
logln(java.lang.Object s, boolean print)
Adds a new line to the log containing the string representation of the given object.void
println(int n)
void
println(java.lang.String s)
void
writeToFile()
-
Field Details
-
content
protected java.util.ArrayList<java.lang.String> content
-
-
Constructor Details
-
Logger
public Logger()
-
-
Method Details
-
enable
public void enable(java.lang.String folderPath)Creates the log file at the given path with a default file name. The file name will consist of a time stamp followed by ".log"- Parameters:
folderPath
-
-
enable
public void enable(java.lang.String folderPath, java.lang.String fileName, boolean useTimeStamp)Creates the log folder at the given path, and creates the log file with a file name that starts with a time stamp and then the given file name.- Parameters:
folderPath
-fileName
-useTimeStamp
-
-
enable
public void enable(java.lang.String folderPath, java.lang.String fileName)Creates the log folder at the specified path, and creates a log file with the specified name.- Parameters:
folderPath
-fileName
-
-
getDateString
public static java.lang.String getDateString()Returns a string that represents the current date and time.- Returns:
-
logln
public void logln()Adds a blank line to the log.
Note however that this is not yet written to file, until you call writeToFile()- Parameters:
s
-print
- If set to true the text will also be printed to the standard output stream.
-
logln
public void logln(java.lang.Object s)Adds a new line to the log containing the string representation of the given object.
Note however that this is not yet written to file, until you call writeToFile()- Parameters:
s
-
-
logln
public void logln(java.lang.Object s, boolean print)Adds a new line to the log containing the string representation of the given object.
Note however that this is not yet written to file, until you call writeToFile()- Parameters:
s
-print
- If set to true the text will also be printed to the standard output stream.
-
log
public void log(java.lang.Throwable e) -
log
public void log(java.lang.String s)Appends text to the last line in the log.
Note however that this is not yet written to file, until you call writeToFile()- Parameters:
s
-print
-
-
log
public void log(java.lang.String s, boolean print)Appends text to the last line in the log.
Note however that this is not yet written to file, until you call writeToFile()- Parameters:
s
-print
-
-
log
public void log(int n) -
log
public void log(int n, boolean print) -
println
public void println(java.lang.String s) -
println
public void println(int n) -
writeToFile
public void writeToFile() -
getLogFolderPath
public java.lang.String getLogFolderPath()Returns the path to the folder where the log file will be stored.- Returns:
-
getLogFileName
public java.lang.String getLogFileName()Returns the name of the log file.- Returns:
-